<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        let obj = {uname:'张三',age:20,email:'zhangsan@qq.com',tst:{x:1,y:100}};

        //获取对象中所有的键名：
       let keyArr =  Object.keys(obj);
       console.log(keyArr);

       //获取对象中所有的键值：
       let valArr = Object.values(obj);
       console.log(valArr);


       let obj2 = {gname:'小米手机',price:3000};
       let obj3 = {};

       //对象的合并( 拷贝 )：Object.assign()为浅拷贝
       Object.assign(obj3,obj2,obj);  //为浅拷贝

       console.log(obj3,'obj3');

       obj3.tst.x = 99;  

       console.log(obj3,obj);


       let str = '{"s":11,"t":77}'
       let strObj = JSON.parse(str);  //将字符串格式的JSON转换成JSON对象
       console.log(strObj,strObj.t);

      let str2 = JSON.stringify(strObj)
      console.log(str2);


    </script>
</head>
<body>
    
</body>
</html>